package com.ego.seckill.controller;

import com.ego.seckill.pojo.SeckillGoods;
import com.ego.seckill.service.SeckillService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import javax.annotation.Resource;

/**
 * @author Ares
 * @date 2020-12-17
 */
@Controller
public class SeckillItemController {

    @Resource
    private SeckillService seckillService;

    @GetMapping("/seckill-item/{id}.html")
    public String item(@PathVariable("id") Long id, Model model) {
        SeckillGoods seckillGoods = seckillService.findById(id);
        model.addAttribute("seckillGoods", seckillGoods);
        return "seckill-item";
    }

}
